(function (win, doc) {
  if (!win.addEventListener) return
  function setFont () {
    var baseFontSize = 100 // 设计稿100px相当于1rem,设计稿一般为750px  也就是7.5rem
    var designWidth = 750 // 设计稿的宽度
    var html = document.documentElement
    var width = html.clientWidth // 屏幕宽度
    var currentFontSize = (width / designWidth) * baseFontSize
    console.log(currentFontSize)
    html.style.fontSize = currentFontSize + 'px'
  }
  setFont()
  setTimeout(function () {
    setFont()
  }, 300)
  doc.addEventListener('DOMContentLoaded', setFont, false)
  win.addEventListener('resize', setFont, false)
  win.addEventListener('load', setFont, false)
})(window, document)
